<script src="/Public/tinymce/tinymce.min.js"></script>
<script>
    tinymce.init({
        selector: '.editor',
        language: 'zh_CN',
        paste_data_images: true,
        content_style: "img {max-width:100%;}",
        plugins: 'print preview searchreplace autolink directionality visualchars fullscreen image template code table charmap hr nonbreaking advlist lists wordcount imagetools textpattern paste autoresize',
        toolbar: 'code undo redo restoredraft | forecolor backcolor bold italic underline strikethrough | blockquote subscript superscript removeformat | \
        alignleft aligncenter alignright alignjustify outdent indent indent2em lineheight | image | \
        formatselect fontselect fontsizeselect | \
        table charmap hr ',
        fontsize_formats: '12px 14px 16px 18px 21px 24px 26px 28px 30px 36px 48px 56px 72px',
        font_formats: '微软雅黑=Microsoft YaHei,Helvetica Neue,PingFang SC,sans-serif 默认字体;苹果苹方=PingFang SC,Microsoft YaHei,sans-serif;宋体=simsun,serif;仿宋体=FangSong,serif;黑体=SimHei,sans-serif;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats;知乎配置=BlinkMacSystemFont, Helvetica Neue, PingFang SC, Microsoft YaHei, Source Han Sans SC, Noto Sans CJK SC, WenQuanYi Micro Hei, sans-serif;小米配置=Helvetica Neue,Helvetica,Arial,Microsoft Yahei,Hiragino Sans GB,Heiti SC,WenQuanYi Micro Hei,sans-serif',
        autosave_ask_before_unload: false,
        toolbar_mode: 'wrap',
        images_upload_url: '/system/upload/img?type=image&dofor=tinymce',
        setup: function(editor) {
            editor.on('change', function() {
                editor.save();
            });
        }
    });
</script>
<style>
    .img-box {
        border: 1px solid #e8e8e8;
        border-radius: 5px;
        cursor: pointer;
        padding: 10px;
        width: 200px;
        float: left;
        margin-right: 10px;
        margin-bottom: 10px;
    }
    
    .img-box-img {
        margin-bottom: 10px;
    }
    
    .img-box-img img {
        width: 100%;
        height: 100%;
    }
</style>
<form class="layui-form close-dialog" style="padding:20px;" onsubmit="return false;" action="/game/notice_image/edit_notice_image" method="post">
    <div class="layui-tab">
        <ul class="layui-tab-title">
            <li class="layui-this">基础信息</li>
            <li>预约多图</li>
        </ul>
        <div class="layui-tab-content" style="padding-top:20px;">
            <div class="layui-tab-item layui-show">
                <div class="layui-row">
                    <div class="layui-col-xs6 layui-col-sm6 layui-col-md4">
                        <div class="layui-form-item">
                            <label class="layui-form-label">预约标题：</label>
                            <div class="layui-input-block">
                                <textarea name="title" placeholder="请输入预约标题" required lay-verify="required" class="layui-textarea">{$info.title}</textarea>
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <label class="layui-form-label">预约封面：</label>
                            <div class="layui-input-block">
                                <div class="xy-upload">
                                    <input type="text" name="image" style="width:300px;display:inline-block" value="{$info.image}" placeholder="请输入预约封面地址" class="layui-input xy-upload-img-input">
                                    <a href="javascript:;" class="layui-btn xy-upload-img">上传封面</a>
                                    <div class="xy-upload-img-box" style="">
                                        <if condition="$info['image']">
                                            <img src="{$info.image}">
                                            <else/>
                                            <span style="font-size:30px;line-height:80px;color:#eee;width: 100px;display:inline-block;background:#f8f8f8;text-align: center;">封面</span>
                                        </if>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">排序：</label>
                            <div class="layui-input-inline">
                                <input type="number" name="listorder" value="{$info.listorder|default=0}" required lay-verify="required|number" placeholder="请输入排序值" autocomplete="off" class="layui-input">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">状态</label>
                            <div class="layui-input-inline">
                                <php>
                                    $status = C('Status'); $statusTitle = C('StatusTitle');
                                </php>
                                <?php
                                    if(!$info['status']){
                                        $info['status'] = 1;
                                    }
                                    for($i = 0 ; $i < count($status) ;$i++){
                                        if($info['status'] == $status[$i]){
                                            echo '<input type="radio" name="status" value="'.$status[$i].'" title="'.$statusTitle[$i].'" checked>';
                                        }else{
                                            echo '<input type="radio" name="status" value="'.$status[$i].'" title="'.$statusTitle[$i].'">';
                                        }
                                    }    
                                ?>
                            </div>
                        </div>
                    </div>
                    <div class="layui-col-xs6 layui-col-sm6 layui-col-md6">
                        <div class="layui-form-item layui-form-text">
                            <label class="layui-form-label">详细介绍：</label>
                            <div class="layui-input-block">
                                <textarea class="editor" name="content">{$info.content}</textarea>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <div class="layui-tab-item">
                <div class="layui-clear">
                    <blockquote class="layui-elem-quote layui-quote-nm fl" style="padding:6px 15px;float:left">提示：添加预约多图</blockquote>
                    <a class="layui-btn xy-upload-imgs fr" style="float:right" href="javascript:;">添加图片</a>
                    <input type="hidden" name="imglist_web" value="1">
                </div>
                <div class="sortable layui-clear" id="img-list">
                    <php> $info['imglist'] = json_decode($info['imglist'],true);</php>
                    <volist name="info['imglist']" id="vo">
                        <php>$id = uniqid();</php>
                        <div class="img-box" id="{$id}">
                            <div class="img-box-img">
                                <img src="{$vo.url}?imageView2/1/w/300/h/300/q/75">
                                <textarea style="display: none;" name="imglist[]">{:json_encode($vo,JSON_UNESCAPED_UNICODE)}</textarea>
                            </div>
                            <div class="img-box-action layui-clear">
                                <a href="javascript:think_remove_dom('#{$id}');" class="layui-btn layui-btn-sm layui-btn-danger fr">删除</a>
                            </div>
                        </div>
                    </volist>
                </div>
            </div>
        </div>
    </div>


    <div class="layui-form-item xy-bottom">
        <if condition="$_GET['iscopy'] neq 1">
            <input type="hidden" name="id" id="id" value="{$_REQUEST['id']}">
        </if>
        <if condition="$_SESSION['loginUser']['role'] neq 'admin'">
            <input type="hidden" name="uid" value="{$_SESSION['loginUser']['id']}">
        </if>
        <button class="layui-btn" lay-submit="" lay-filter="*">立即保存</button>
    </div>
</form>

<script>
    layui.use(['element', 'jqueryui'], function() {
        $(".sortable").sortable();
        $(".sortable").disableSelection();
    });
</script>